using UnityEngine;

namespace PlatformShoot
{
    public class Bullet : MonoBehaviour
    {
       private LayerMask mLayerMask;
        void Start()
        {
            GameObject.Destroy(this.gameObject, 2f);
            mLayerMask = LayerMask.GetMask("Ground", "Trigger");
        }

        void Update()
        {
            transform.Translate(20 * Time.deltaTime, 0, 0);
        }

        private void FixedUpdate()
        {
            if (Physics2D.OverlapBox(transform.position, transform.localPosition, 0, mLayerMask))
            {
                GameObject.Destroy(gameObject);
            }
        }
    }
}



